//
//  CoverView.swift
//  SwiftOfXiaoShouJia
//
//  Created by zhenjingxiong on 2018/8/31.
//  Copyright © 2018年 镇景雄. All rights reserved.
//

import UIKit

class CoverView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.addSubview(self.topView)
        
        self.topView.addSubview(self.clickButton)
        self.clickButton.snp.makeConstraints { (make) in
            make.left.equalTo(0)
            make.top.equalTo(0)
            make.width.equalTo(200)
            make.height.equalTo(40)
        }
        
    }
    
    lazy var topView = { () -> UIView in
        let view = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 375, height: 50))
        view.backgroundColor = UIColor.white
        return view
    }()
    
    lazy var clickButton = { () ->UIButton in
        let button = UIButton.init()
        button.setTitle("佛山无影脚", for: UIControlState.normal)
        button.setTitleColor(UIColor.black, for: UIControlState.normal)
        button.titleLabel?.font = UIFont.systemFont(ofSize: 14)
        button.backgroundColor = UIColor.green
        return button
    }()
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.removeFromSuperview()
    }
    
}
